<div class="layui-card">
    <div class="layui-card-header">
        <h2>分配子角色</h2>
    </div>
    <div class="layui-card-body">
        <form class="layui-form" action="<?php echo \yii\helpers\Url::to(['role','name'=>$model->name])?>" method="post">
            <div class="layui-form-item">
                <label for="" class="layui-form-label">标识</label>
                <div class="layui-form-mid layui-word-aux">
                    <?php echo $model->name; ?>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="" class="layui-form-label">名称</label>
                <div class="layui-form-mid layui-word-aux">
                    <?php echo $model->description; ?>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="" class="layui-form-label">子角色</label>
                <div class="layui-input-block">
                    <?php foreach ($roles as $key=>$role):?>
                        <input <?php echo in_array($key,array_keys($ownRoles))?'checked':'' ?> type="checkbox" name="role[]" value="<?php echo $role->name ?>" title="<?php echo $role->description ?>">
                    <?php endforeach;?>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn">确认</button>
                    <a href="<?php echo \yii\helpers\Url::to(['index']); ?>" class="layui-btn layui-btn-primary">返回</a>
                </div>
            </div>
        </form>
    </div>
</div>


<?php
$js = <<<JS
    layui.use(['form','element','table', 'layer'],function() {
        var form = layui.form;  
        var element = layui.element;  
        var table = layui.table;  
        var layer = layui.layer;  
        
    });
JS;
$this->registerJs($js);
